package com.example.demo.rest.account;

import com.example.demo.api.account.GlApi;
import com.example.demo.util.BASE64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Mobile {
    @Autowired
    private GlApi glApi;


    @GetMapping("/mobile/auth")
    public Object syncSwitch(@RequestParam("username") String username,@RequestParam("password") String password) {
        String key = String.format("%s:%s",username,password);
        String authorization = String.format("Basic %s",BASE64.encrypt(key));
        return glApi.mobileAuthenticate(authorization);
    }
}
